const Service = require('egg').Service;

class NewsService extends Service {

  getNewsByUser({ size = 10, page = 1 }) {
    const newsList = [];
    for (let index = 1; index <= size; index++) {
      const id = (page - 1) * size + index;
      const ele = {
        id,
        storeName: '店铺名称' + id,
        content: '主要内容主要内容主要内容主要内容主要内容主要内容' + id,
        urls: [
          'https://cdn.uviewui.com/uview/album/1.jpg',
          'https://cdn.uviewui.com/uview/album/2.jpg',
          'https://cdn.uviewui.com/uview/album/3.jpg',
          'https://cdn.uviewui.com/uview/album/4.jpg',
          'https://cdn.uviewui.com/uview/album/5.jpg',
          'https://cdn.uviewui.com/uview/album/6.jpg',
          'https://cdn.uviewui.com/uview/album/7.jpg',
          'https://cdn.uviewui.com/uview/album/8.jpg',
          'https://cdn.uviewui.com/uview/album/9.jpg',
          'https://cdn.uviewui.com/uview/album/10.jpg',
        ],
      };
      newsList.push(ele);
    }
    return { rows: newsList, total: size * 7, size, page };
  }

}

module.exports = NewsService;
